package br.com.imob.portal.action;

import java.util.List;

import br.com.imob.factory.ImobFactory;
import br.com.imob.model.ImobItem;
import br.com.imob.service.ImobService;
import br.com.imob.util.Goal;

import com.opensymphony.xwork2.Preparable;


public class SearchAction extends GenericAction implements Preparable {
	
	private static final long serialVersionUID = 1L;
	
	private ImobService service;
	
	private List<ImobItem> items;
	
	public void prepare() throws Exception {
		
		service = ImobFactory.createImobService();
	}
	
	public String search(){
		
		ImobItem criteria = new ImobItem();
		criteria.setNeighbor("Santa*");
		criteria.setGoal( Goal.RENT.toString() );
		
		items = service.selectImobs(0, 20, criteria);
		
		return SUCCESS;
	}



	public ImobService getService() {
		return service;
	}



	public void setService(ImobService service) {
		this.service = service;
	}



	public List<ImobItem> getItems() {
		return items;
	}



	public void setItems(List<ImobItem> items) {
		this.items = items;
	}



	

}
